6 /// This class implements a uniform random generator with a minimum and maximum values.
8 public class UniformRandom
: NumberGenerator
10 // Represents the minimum value reteurned by this uniform random generator.
13 // Represents the maximum value reteurned by this uniform random generator.
16 // Represents the pseudo-random number generator used to generate random numbers.
17 private Random MyUniformRandom
;
20 /// Creates a new uniform random generator with the specified minimum and maximum values.
22 /// <param name="Min">Represents the minimum value reteurned by this uniform random generator.</param>
23 /// <param name="Max">Represents the maximum value reteurned by this uniform random generator.</param>
24 public UniformRandom(double Min
, double Max
)
28 MyUniformRandom
= new Random();
32 /// Creates a new uniform random generator with the specified minimum and maximum values and with the specified seed.
34 /// <param name="Min">Represents the minimum value reteurned by this uniform random generator.</param>
35 /// <param name="Max">Represents the maximum value reteurned by this uniform random generator.</param>
36 /// <param name="Seed">Represents the seed used for the internal pseudo-random number generator.</param>
37 public UniformRandom(double Min
, double Max
, int Seed
)
41 MyUniformRandom
= new Random(Seed
);
45 /// This function returns the next uniform-randomly generated double number.
47 /// <returns>The next uniform-random double number.</returns>
48 public double NextDouble()
50 return MyUniformRandom
.NextDouble() * (Max
- Min
) + Min
;